<?php

/**
 * @package Core
 * @version $Id: Autoload.php 685 2009-08-03 06:28:25Z songxiang $
 */

class Core_Autoload {
    public function __construct(){

    }

    public static function registerAutoload () {
        spl_autoload_register(array(
            'Core_Autoload' ,
            'autoload'));
    }

    public static function autoload ($class) {
        $class = str_replace('_', DIRECTORY_SEPARATOR, $class);
        if (strpos($class, 'Core' . DIRECTORY_SEPARATOR) === 0){
            require CORE_PATH . $class . '.php';
        }else{
            $file = PROJECT_PATH . $class . '.php';
            if (file_exists($file)){
                require $file;
            }
        }
    }
}
